package model;

import java.util.Date;

public class User {
    private int id;
    private String nickname;
    private String username;
    private String password;
    private String email;
    private Date create_time;
    private boolean admin;
    private String avatar;
    private Order order;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getNickname() {
        return  nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Date getCreate_time() {
        return create_time;
    }

    public void setCreate_time(Date create_time) {
        this.create_time = create_time;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    // 添加 isAdmin() 方法
    public boolean isAdmin() {
        return admin;
    }

    // 添加 setAdmin() 方法
    public void setAdmin(boolean admin) {
        this.admin = admin;
    }

    public Order getOrder() { return order; }
    public void setOrder(Order order) { this.order = order; }

    @Override
    public String toString() {
        return "User [id=" + id + ", nickname=" + nickname + ", username=" + username + ", password=" + password + ", email=" + email + ", create_time="
                + create_time + ", is_admin=" + admin + ", avatar=" + avatar + "]";
    }

    public User(int id, String nickname, String username, String password, String email, Date create_time, boolean is_admin, String avatar) {
        super();
        this.id = id;
        this.nickname = nickname;
        this.username = username;
        this.password = password;
        this.email = email;
        this.create_time = create_time;
        this.admin = is_admin;
        this.avatar = avatar;
    }

    public User( String nickname, String username, String password, String email, Date create_time, boolean is_admin, String avatar) {
        this.nickname = nickname;
        this.username = username;
        this.password = password;
        this.email = email;
        this.create_time = create_time;
        this.admin = is_admin; // 修正构造函数中赋值问题
        this.avatar = avatar;
    }

    public User() {
        super();
    }
}
